<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/html/axios.min.js"></script>
    <script>
        function $(id) {
            return document.getElementById(id)
        }
        var img;
        function check(radio) {
            img=$("faceValue").value=radio;
        }
        function registerUser() {
            axios.get("/user/add",{
                params: {
                    name:$("userName").value,
                    pwd:$("pwd").value,
                    email:$("email").value,
                    image:img
                }
            }).then(resp=>{
                if (resp.data=="ok"){
                    $("registerOk").innerHTML="注册成功,<a href='/html/login.html'>请登录</a>"
                }
            })
        }
    </script>
</head>
<body>
    <h3>新用户注册</h3>
    <form>
    用户名：<input type="text" id="userName"><br>
    <span>请输入1-10个字符</span><br>
    用户密码：<input type="password" id="pwd"><br>
    <span>请输入1-10个字符</span><br>
    密码确认：<input type="password" id="rPwd"><br>
    <span>请输入1-10个字符,要与密码相同</span><br>
    用户邮箱：<input type="text" id="email"><br>
    <span>形如aa@bb.com</span><br>
    用户头像：<input type="radio" name="face" id="faceImg1" value="1.jpg">
    <img src="img/1.jpg" width="50px" height="50px">
    <input type="radio" name="face" id="faceImg2" value="2.jpg" onclick="check(this.value)">
    <img src="img/2.jpg" width="50px" height="50px">
    <input type="radio" name="face" id="faceImg3" value="3.jpg" onclick="check(this.value)">
    <img src="img/3.jpg" width="50px" height="50px">
    <input type="radio" name="face" id="faceImg4" value="4.jpg" onclick="check(this.value)">
    <img src="img/4.jpg" width="50px" height="50px">
    <input type="radio" name="face" id="faceImg5" value="5.jpg" onclick="check(this.value)">
    <img src="img/5.jpg" width="50px" height="50px"><br>
    <input type="hidden" id="faceValue" >
    <input type="button" value="注册" onclick="registerUser()">
    <input type="reset" value="重置">
    </form>
    <span id="registerOk"></span>
</body>
</html>